#include "ofc/DArray.h"
#include "ofc/DText.h"
#include "ofc/DInt.h"

int main(int argc, char *argv[])
{
  DArray *array = [DArray alloc];
  DText  *str;
  DInt   *nr;
  id      obj;

  [array init : 10];      // Start with length 10

                          // Put objects in the array
  str = [DText new]; [str set :"String1"];
  [array set :0 :str];

  str = [DText new]; [str set :"String2"];
  [array set :1 :str];

  nr = [DInt alloc]; [nr init :3];
  [array set :2 :nr];

  nr = [DInt alloc]; [nr init :4];
  [array set :3 :nr];

                          // Get objects from the array
  obj = [array get :4];   // id = nil

  obj = [array get :1];   // id = DText("String2")
  if ([obj isKindOf :[DText class]])
    printf("Text:%s\n", [obj cstring]);

  if ([obj isKindOf :[DInt class]])
    printf("Number:%d\n", [obj get]);

  [array free];           // Free the array and the stored objects

  return 0;
}

